package test;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.junit.Test;

import com.ityunhe.bean.Garden;
import com.ityunhe.bean.Goods;
import com.ityunhe.bean.Page;
import com.ityunhe.dao.impl.GoodsShowDaoImpl;

public class GoodShow {
	/**
	 * 
	 */
	@Test
	public void pagetest(){
		
		Page page = new Page();
		page.setPageSize(5);
		page.setPageIndex(1);
		//得到总记录数
		GoodsShowDaoImpl goodsShowDaoImpl = new GoodsShowDaoImpl();
		Map map = new HashMap();
		map.put("gaid", 6);
		//map.put("gsid", 22);
		int countList = goodsShowDaoImpl.countList(map);
		System.out.println(countList);
		page.setTotleCount(countList);
		map.put("pageSize", page.getPageSize());
		map.put("pageIndex", page.getPageIndex()-1);
		//
		List<Map> listGoodsPage = goodsShowDaoImpl.listGoodsPage(map);
		for (Map goods : listGoodsPage) {
			
			System.out.println(goods.get("nickname"));
		}
		
		
		
			
			
	}
	@Test
	public void totleCount(){
		GoodsShowDaoImpl goodsShowDaoImpl = new GoodsShowDaoImpl();
		Map map = new HashMap();
		map.put("gaid", 7);
		//map.put("gsid", 22);
		int countList = goodsShowDaoImpl.countList(map);
		System.out.println(countList);
	}	
	@Test
	public void listGardensTest() {
		// TODO Auto-generated method stub
		GoodsShowDaoImpl goodsShowDaoImpl = new GoodsShowDaoImpl();
		List<Garden> listGardens = goodsShowDaoImpl.listGardens();
		for (Garden garden : listGardens) {
			System.out.println(garden);
		}
	}
}
